﻿namespace FlowControl
{
    class FlowReadCFG : FlowBase
    {
        public override void Activate()
        {
            base.Activate();
            ZEventCenter.AddEventListener(ConstData.CFGLOAD_COMPLETE, OnComplete);
            DBSystemMgr.GetSingleton();
            LoadBoardMgr.GetSingleton().Reset();
            LoadBoardMgr.GetSingleton().SetDescri(GlobalString.readCfg);
            LoadBoardMgr.GetSingleton().Show();
        }

        public override void FlowUpdate(float duringTime)
        {
            base.FlowUpdate(duringTime);
            LoadBoardMgr.GetSingleton().SetPercent(DBSystemMgr.GetSingleton().LoadProgress);
        }

        private void OnComplete(ZEvent ev)
        {
            ZEventCenter.RemoveEventListener(ConstData.CFGLOAD_COMPLETE, OnComplete);
            IsComplete = true;
        }
    }
}